<!--
 * @Author: 又帅又爱学习 501879094@qq.com
 * @Date: 2022-03-28 17:41:14
 * @LastEditors: 又帅又爱学习 501879094@qq.com
 * @LastEditTime: 2022-10-17 17:41:34
 * @FilePath: /vue_demo/src/views/Demo05.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
/** 需求：实现页面缓存（home--》bind缓存，about--》bing刷新） */
<template>
  <div id="app">
    <div id="nav">
      <router-link to="/demo05">事件参数</router-link>
      &nbsp;
      <router-link to="/bind">双向绑定失效</router-link>
      &nbsp;
      <router-link to="/about">列表渲染</router-link>
    </div>
    <hr>
    <keep-alive :include="$store.state.cachedViews">
      <router-view />
    </keep-alive>
  </div>
</template>
<script>
export default {
  name: 'Demo05',
  computed: {
    cachedViews() {
      console.log('sasa---', this.$store.state.cachedViews)
      return this.$store.state.cachedViews
    },
    key() {
      return this.$route.fullPath
    }
  }
}
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
